<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <link rel="stylesheet" type="text/css" href="https://www.layuicdn.com/layui/css/layui.css" />
    <title>{{title}}</title>
    <style>
        #app {
            background-color: #f2f2f2;
        }

        .layui-fluid {
            padding: 15px;
        }

        .layadmin-header {
            display: none;
            height: 50px;
            line-height: 50px;
            margin-bottom: 0;
            border-radius: 0
        }

        .layadmin-header .layui-breadcrumb {
            padding: 0 15px
        }

        .layui-card-header {
            position: relative
        }

        .layui-card-header .layui-icon {
            line-height: initial;
            position: absolute;
            right: 15px;
            top: 50%;
            margin-top: -7px
        }

        .layadmin-tabspage-none .layadmin-header {
            display: block
        }
    </style>
</head>
<body>
    <!-- (**组件**)必须放到一个根容器中 -->
    <div id="app"></div>
    <script src="./lib/router_es5.js"></script>
    <script src="https://www.layuicdn.com/layui/layui.js"></script>
    <script>
        let router = new Router({
            el:'#app'
            ,layout:'./view/layout.html'
            ,routerView: '#app-body'
        })
        
        //1、注册routes依赖
        router.route({path:'#/home'},function(html,path){
            this.parse("hello home page !!")
        })

        router.route({path:"#/button",url:'./component/button.html'})

        router.route({path:"#/bdage",url:'./component/bdage.html'})

        router.route({path:"#/form",url:'./component/element.html'})

        router.customEvent.$on('included',function(el,layout){
            router.init("#/home");
            Router.utils.evtListener(document.querySelectorAll('[r-link]'), 'click', function(e){
                router.redirect(this.getAttribute('r-link'))
            })
        });
    </script>
</body>
</html>